package com.pzh.assignment.common.bean.vo;

import com.pzh.assignment.entity.User;
import lombok.Data;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

@Data
public class LoginVO {
    private UserVO user;
    private List roles;
    private String token;
    private Date expireAt;

    public static LoginVO valueOf(User user, String role, String group, String token, Date expireAt){
        LoginVO vo = new LoginVO();
        vo.setUser(UserVO.valueOf(user, role, group));
        vo.setRoles(Arrays.asList(role));
        vo.setToken(token);
        vo.setExpireAt(expireAt);
        return vo;
    }

}
